﻿using Abp.Castle.Logging.Log4Net;
using Abp.Dependency;
using Abp.Web;
using Castle.Facilities.Logging;
using System;
using System.IO;
using Teleware.Newbe.Navigation.Web.Domain;
using Teleware.Newbe.Navigation.Web.Domain.Services;
using Teleware.Newbe.Navigation.Web.Modules;

namespace Teleware.Newbe.Navigation.Web
{
    public class Global : AbpWebApplication<NewbeStartupModule>
    {
        protected override void Application_Start(object sender, EventArgs e)
        {
            base.Application_Start(sender, e);
            using (var db = new NewbeDbContext())
            {
                db.Database.Connection.Open();
            }
            IocManager.Instance.IocContainer.AddFacility<LoggingFacility>(f =>
                f.UseAbpLog4Net()
                    .WithConfig(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log4net.config")));
            var dataInitService = IocManager.Instance.Resolve<IDataInitService>();
            //            dataInitService.Init();
        }
    }
}
